﻿/*****************************************************************//**
 * @file   VAOneXMLAdaptorSeaCavity.h
 * @brief  VAOne读写SEA声腔适配器
 * 
 * @author lixiaolong (lixiaolong@diso.cn)
 * @date   2024-11-12
 *********************************************************************/
#ifndef VAONEXMLADAPTORSEACAVITY_H
#define VAONEXMLADAPTORSEACAVITY_H

#include "FITKVAOneXMLIOAPI.h"
#include "FITKAbstractVAOneXMLAdaptor.h"
#include "FITK_Kernel/FITKCore/FITKCoreMacros.h"
#include "FITK_Kernel/FITKAdaptor/FITKIOAdaptorFactory.h"

namespace Acoustics
{
    class FITKAcousticsSEASubSysManager;
    class FITKAbstractSEASubSys;
    class FITKSEASubSysCavity;
}

namespace IO
{
    /**
     * @brief   VAOne读写板适配器
     * @author  lixiaolong (lixiaolong@diso.cn)
     * @data    2024-11-7
     */
    class FITKVAOneXMLIOAPI VAOneXMLAdaptorSeaCavity : public FITKAbstractVAOneXMLAdaptor
    {
        FITKCLASS(IO, VAOneXMLAdaptorSeaCavity);
    public:

        /**
         * @brief   构造函数
         * @author  lixiaolong (lixiaolong@diso.cn)
         * @data    2024-11-7
         */
        explicit VAOneXMLAdaptorSeaCavity()= default;

        /**
         * @brief   析构函数
         * @author  lixiaolong (lixiaolong@diso.cn)
         * @data    2024-11-7
         */
        ~VAOneXMLAdaptorSeaCavity() = default;

        /**
         * @brief   适配器读数据
         * @return  是否执行成功
         * @author  lixiaolong (lixiaolong@diso.cn)
         * @date    2024-11-7
         */
        bool adaptR() override;

        /**
         * @brief   适配器写数据
         * @return  是否执行成功
         * @author  lixiaolong (lixiaolong@diso.cn)
         * @date    2024-11-7
         */
        bool adaptW() override;

    private:

        /**
         * @brief   读取损耗因子数据
         * @param[i] node   xml节点数据
         * @param[o] data   节点数据
         * @author  lixiaolong (lixiaolong@diso.cn)
         * @date    2024-11-8
         */
        void readDamping(rapidxml::xml_node<char>* node, Acoustics::FITKSEASubSysCavity *data);

        /**
         * @brief   读取几何数据
         * @param[i] node   xml节点数据
         * @param[o] data   节点数据
         * @author  lixiaolong (lixiaolong@diso.cn)
         * @date    2024-11-8
         */
        void readGeo(rapidxml::xml_node<char>* node, Acoustics::FITKSEASubSysCavity *data);

        /**
         * @brief   读取压力数据
         * @param[i] node   xml节点数据
         * @param[o] data   节点数据
         * @author  lixiaolong (lixiaolong@diso.cn)
         * @date    2024-11-8
         */
        void readPress(rapidxml::xml_node<char>* node, Acoustics::FITKSEASubSysCavity *data);

        /**
         * @brief   读取单个单元数据
         * @param[i] node   xml节点数据
         * @param[o] data   节点数据
         * @author  lixiaolong (lixiaolong@diso.cn)
         * @date    2024-11-8
         */
        void readCell(rapidxml::xml_node<char>* node, Acoustics::FITKSEASubSysCavity *data);

        /**
         * @brief  写损耗因子谱数据
         * @param[i] data   节点数据
         * @param[o] node   xml节点数据
         * @author  lixiaolong (lixiaolong@diso.cn)
         * @date    2024-11-8
         */
        void writeDamping(Acoustics::FITKSEASubSysCavity *data, rapidxml::xml_node<char>* node);

        /**
         * @brief   写几何数据
         * @param[i] data   节点数据
         * @param[o] node   xml节点数据
         * @author  lixiaolong (lixiaolong@diso.cn)
         * @date    2024-11-8
         */
        void writeGeo(Acoustics::FITKSEASubSysCavity *data, rapidxml::xml_node<char>* node);

        /**
         * @brief   写入压力数据
         * @param[i] data   节点数据
         * @param[o] node   xml节点数据
         * @author  lixiaolong (lixiaolong@diso.cn)
         * @date    2024-11-8
         */
        void writePress(Acoustics::FITKSEASubSysCavity *data, rapidxml::xml_node<char>* node);

        /**
         * @brief   写入单个单元数据
         * @param[i] data   节点数据
         * @param[o] node    xml节点数据
         * @author  lixiaolong (lixiaolong@diso.cn)
         * @date    2024-11-8
         */
        void writeCell(Acoustics::FITKSEASubSysCavity *data, rapidxml::xml_node<char>* node);

    private:
    };

    Register2FITKIOAdaptorFactory(VAOneXMLCavity, Acoustics::FITKAcousticsSEASubSysManager, VAOneXMLAdaptorSeaCavity)
}

#endif // VAONEXMLADAPTORSEACAVITY_H
